package org.termine.jsf;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class BaseJSF {

	public void setInfoMessage(String message) {
		FacesContext context = FacesContext.getCurrentInstance();
		context.getExternalContext().getFlash().setKeepMessages(true);
		context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "INFO", message));
	}

	public void setErrorMessage(String message) {
		FacesContext context = FacesContext.getCurrentInstance();
		context.getExternalContext().getFlash().setKeepMessages(true);
		context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "ERROR", message));
	}

	public void setFatalMessage(String message) {
		FacesContext context = FacesContext.getCurrentInstance();
		context.getExternalContext().getFlash().setKeepMessages(true);
		context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_FATAL, "FATAL ERROR", message));
	}
}
